package com.zmn.plat.common.dictionary;

/**
 * 渠道工单视频类型枚举
 *
 * @author yangshuangping
 * @since 2021/06/09 15:44
 */
public enum ChannelWorkOrderVideoTypeEnum {

    /**
     * values
     */
    BEFORE_REPAIR(1, "服务前"),
    IN_REPAIR(2, "服务中"),
    AFTER_REPAIR(3, "服务后");

    /**
     * 服务前
     */
    public static final int CONSTS_BEFORE_REPAIR = 1;
    /**
     * 服务中
     */
    public static final int CONSTS_IN_REPAIR = 2;
    /**
     * 服务后
     */
    public static final int CONSTS_AFTER_REPAIR = 3;

    private Integer code;
    private String name;

    ChannelWorkOrderVideoTypeEnum(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    public Integer getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    public static ChannelWorkOrderVideoTypeEnum of(Integer code) {
        if (code == null) {
            return null;
        }
        switch (code) {
            case 1:
                return BEFORE_REPAIR;
            case 2:
                return IN_REPAIR;
            case 3:
                return AFTER_REPAIR;
            default:
                return null;
        }
    }

    public static String getName(Integer code) {
        ChannelWorkOrderVideoTypeEnum of = of(code);
        return of == null ? null : of.getName();
    }

    public static ChannelWorkOrderVideoTypeEnum[] completeOrCancelType() {
        return new ChannelWorkOrderVideoTypeEnum[]{BEFORE_REPAIR, IN_REPAIR, AFTER_REPAIR};
    }

    public static ChannelWorkOrderVideoTypeEnum[] specialOfferType() {
        return new ChannelWorkOrderVideoTypeEnum[]{BEFORE_REPAIR, IN_REPAIR, AFTER_REPAIR};
    }
}
